extends CanvasLayer

signal start_game

func show_message(text):
	$Message.text = text
	$Message.show()
	$MessageTimer.start()


func _on_message_timer_timeout() -> void:
	$Message.hide()
	
func update_score(score: String):
	$Score.text = score

func show_game_over():
	show_message("Game Over")
	print("show gameover, await finished")
	await $MessageTimer.timeout
	
	print("ready to restart new game")
	$Message.text = "Hit More!"
	$Message.show()
	await get_tree().create_timer(1.0).timeout
	$StartButton.show()


func _on_start_button_pressed() -> void:
	$StartButton.hide()
	start_game.emit()
